import fetch from 'common/src/utils/fetch';
import UTILS from "common/src/utils/utils";
export function getList(data) {
  return fetch({
    url: '/api/designservice/tutor/out/list',
    method: 'post',
    headers: { 'Content-Type': 'application/json' },
    data
  });
}


/**
 * 下载模板
 */
export function downTemplate(){
  return fetch({
    url: '/api/designservice/tutor/out/template',
    method: 'get',
    responseType: 'blob'
  }).then(res => {
    UTILS.downloadFile(res, '校外导师导入模板.xls', 'application/vnd.ms-excel;charset=utf-8');
  });
}

//新增
export function addData(data) {
  return fetch({
    url: '/api/designservice/tutor/out/add',
    method: 'post',
    headers: { 'Content-Type': 'application/json' },
    data
  })
}

//编辑
export function editData(data) {
  return fetch({
    url: '/api/designservice/tutor/out/edit',
    method: 'put',
    headers: { 'Content-Type': 'application/json' },
    data
  })
}


//删除
export function deleteData(data) {
  return fetch({
    url: `/api/designservice/tutor/out/delete/${data}`,
    method: 'delete',
    headers: { 'Content-Type': 'application/json' },
  })
}

//审批回调
export function view(id) {
  return fetch({
    url: '/api/designservice/tutor/out/view?id=' + id,
    method: 'get',
    headers: { 'Content-Type': 'application/json' },
  })
}

export function importExcel(file) {
  return fetch({
    url: '/api/designservice/tutor/out/import',
    method: 'post',
    headers: { 'Content-Type': 'multipart/form-data' },
    data: file
  })
}

export function exportData(data) {
  return fetch({
    url: '/api/designservice/tutor/out/export',
    method: 'post',
    headers: { 'Content-Type': 'application/json' },
    data: data
  })
}


export function getReportStatus(key) {
  return fetch({
    url: `/api/designservice/common/exportExcelResult/${key}`,
    method: 'get'
  });
}

export function exportByPath(path) {
  return fetch({
    url: '/api/designservice/common/export?path=' + encodeURI(path),
    method: 'get'
  });
}
export function exportExcel(data) {
  return fetch({
    url: '/api/designservice/tutor/out/export',
    method: 'post',
    headers: { 'Content-Type': 'application/json' },
    data: data
  })
}

